﻿// Created by Windward Studios - no copyright is claimed. This code can be used in
// any manner by anyone for any reason. There is no copyright of any kind on it. You may
// use it in commercial products. You may change it without sharing those changes.
// We ask that you keep the "created by Windward Studios" in a comment at the top.

using System.Data;

namespace net.windward.utils.ado
{
	/// <summary>
	/// This is a parameter for a stored procedure.
	/// </summary>
	public class WrProcParam
	{
		private readonly string name;
		private readonly DbType dbType;
		private readonly int dataLength;
		private readonly bool hasDefault;
		private readonly ParameterDirection direction;

		/// <summary>
		/// Create the parameter descriptor.
		/// </summary>
		/// <param name="name">The name of the parameter.</param>
		/// <param name="dbType">The parameter type.</param>
		/// <param name="dataLength">The number of bytes for this type. 0 if variable.</param>
		/// <param name="hasDefault">true if the parameter has a default value.</param>
		/// <param name="direction">Sets if the parameter is input, output, or both.</param>
		public WrProcParam(string name, DbType dbType, int dataLength, bool hasDefault, ParameterDirection direction)
		{
			this.name = name;
			this.dbType = dbType;
			this.dataLength = dataLength;
			this.hasDefault = hasDefault;
			this.direction = direction;
		}

		/// <summary>
		/// The name of the parameter.
		/// </summary>
		public string Name
		{
			get { return name; }
		}

		/// <summary>
		/// The parameter type.
		/// </summary>
		public DbType DbType
		{
			get { return dbType; }
		}

		/// <summary>
		/// The number of bytes for this type. 0 if variable.
		/// </summary>
		public int DataLength
		{
			get { return dataLength; }
		}

		/// <summary>
		/// true if the parameter has a default value.
		/// </summary>
		public bool HasDefault
		{
			get { return hasDefault; }
		}

		/// <summary>
		/// Sets if the parameter is input, output, or both.
		/// </summary>
		public ParameterDirection Direction
		{
			get { return direction; }
		}
	}
}
